/**
 * @param {string} path
 * @returns {Boolean}
 */
export function isExternal(path) {
  return /^(https?:|mailto:|tel:)/.test(path)
}

/**
 * 学号正则
 */
const userIdPattern = /^\d{12}$/
/**
 * 密码正则
 */
const passwordPattern = /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[a-zA-Z\d]{8,}$/
/**
 * 验证码正则
 */
const captchaPattern = /^\d+$/
/**
 * 学院号正则
 */
const collegeIdPattern = /^\d{4}$/
/**
 * 学院名正则
 */
const collegeNamePattern = /^[\u4e00-\u9fa5]{2,30}$/
/**
 * 专业名正则
 */
const majorIdPattern = /^\d{5}$/
/**
 * 专业名正则
 */
const majorNamePattern = /^[\u4e00-\u9fa5]{2,30}$/
/**
 * 班级名正则
 */
const classIdPattern = /^\d{6}$/
/**
 * 身份证号正则
 */
const cardPattern = /^([1-6][1-9]|50)\d{4}(18|19|20)\d{2}((0[1-9])|10|11|12)(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/
/**
 * 手机号正则
 */
const phonePattern = /^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/

export {
  userIdPattern,
  passwordPattern,
  captchaPattern,
  collegeIdPattern,
  collegeNamePattern,
  majorIdPattern,
  majorNamePattern,
  classIdPattern,
  cardPattern,
  phonePattern
}
